package cn.com.bsfit.netty.demo;

import cn.com.bsfit.netty.config.base.BaseConfigurable;
import cn.com.bsfit.netty.req.ReqData2MapFacade;
import cn.com.bsfit.netty.resp.BaseResponse;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 类名 DemoService
 * 描述 业务逻辑处理demo
 *
 * @author hedonglin
 * @version 1.0
 * @date 2020/1/8 16:50
 */
@Service
public class DemoService implements BaseConfigurable {

    /**
     * 真正的业务逻辑处理
     * @param reqMap 请求数据转化后的Map
     * @param reqData2MapFacade reqData2MapFacade
     * @return map
     * @throws Exception 异常
     */
    public Map<String, Object> reqHandler(Map<String, Object> reqMap, ReqData2MapFacade reqData2MapFacade) throws Exception {
        Map<String, Object> data = new HashMap<>();
        data.put("name", "hedonglin");

        // 获取facade中的数据
        boolean b = reqData2MapFacade.isJson();
        data.put("isJson", b);
        return BaseResponse.builder().success(data);
    }

}
